
header {
    #include <sstream>
    #include <iostream>
    #include "UnicodeCharBuffer.hpp"
    #include "UnicodeCharScanner.hpp"
}

options {
    language="Cpp";
}

class MplLexer extends Lexer("UnicodeCharScanner");

options {
    k = 7;
    // Allow any char but \uFFFF (16 bit -1)
    // hmmm antlr does not allow \u10FFFE
    charVocabulary='\u0000'..'\uFFFE';
    exportVocab=Mpl;
    testLiterals = true;
    noConstructors = true;
}

{
public:
    bool done;

    MplLexer( std::istream& in ) : UnicodeCharScanner(new UnicodeCharBuffer(in),true){
        initLiterals();
    }
    MplLexer( UnicodeCharBuffer& ib ) : UnicodeCharScanner(ib,true){
        initLiterals();
    }

    void uponEOF(){
        done = true;
    }
}


CLASS_KEYWORD: C L A S S;

INTERFACE_KEYWORD: I N T E R F A C E;

EXEPTION_KEYWORD: E X C E P T I O N;

MODULE_KEYOWRD: M O D U L E;

MPL_TYPE_INT: I N T;

MPL_TYPE_STRING: S T R I N G;

MPL_TYPE_UUID: U U I D;

MPL_TYPE_FLOAT: F L O A T;

MPL_TYPE_LONG: L O N G;

MPL_TYPE_BYTE: B Y T E;

BLOCKBEGIN: '{';
BLOCKEND: '}';
ANTOTATIONBEGIN: '[';
ANOTATIONEND: ']';
SENTENCEEND: ';';



protected PLUS: '+';

protected MINUS: '-';
	
protected INT: (DIGIT)+;


NEWLINE
    options {
        generateAmbigWarnings=false;
    }
    : '\r' | '\n';

WS: ' '|'\t';

protected
WORD :
    {
        std::cout<<"Word begin"<<std::endl;
    }
    (LETTER|DIGIT)+
    ;

protected
DIGIT:'0'..'9';

protected
LETTER:'a'..'z'|'A'..'Z'|'\u0080'..'\ufffe';


/**
 * Map chars to rules neded for UTF suport
 */

protected A:'a'|'A';
protected B:'b'|'B';
protected C:'c'|'C';
protected D:'d'|'D';
protected E:'e'|'E';
protected F:'f'|'F';
protected G:'g'|'G';
protected H:'h'|'H';
protected I:'i'|'I';
protected J:'j'|'J';
protected K:'k'|'K';
protected L:'l'|'L';
protected M:'m'|'M';
protected N:'n'|'N';
protected O:'o'|'O';
protected P:'p'|'P';
protected Q:'q'|'Q';
protected R:'r'|'R';
protected S:'s'|'S';
protected T:'t'|'T';
protected U:'u'|'U';
protected V:'v'|'V';
protected W:'w'|'W';
protected X:'x'|'X';
protected Y:'y'|'Y';
protected Z:'z'|'Z';
